blob: 5b99dd2c2ff8de7f1f14378ff017c5ef3c8edc5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import { GroupTabs } from '@/app/groups/[groupId]/group-tabs'
import { SaveGroupLocally } from '@/app/groups/[groupId]/save-recent-group'
import { Button } from '@/components/ui/button'
import { getGroup } from '@/lib/api'
import { ChevronLeft } from 'lucide-react'
import Link from 'next/link'
import { notFound } from 'next/navigation'
import { PropsWithChildren } from 'react'
export default async function GroupLayout({
children,
params: { groupId },
}: PropsWithChildren<{
params: { groupId: string }
}>) {
const group = await getGroup(groupId)
if (!group) notFound()
return (
<>
<div className="mb-4 flex justify-between">
<Button variant="ghost" asChild>
<Link href="/groups">
<ChevronLeft className="w-4 h-4 mr-2" /> Back to recent groups
</Link>
</Button>
</div>
<h1 className="font-bold text-2xl mb-4">
<Link href={`/groups/${groupId}`}>{group.name}</Link>
</h1>
<GroupTabs groupId={groupId} />
{children}
<SaveGroupLocally group={{ id: group.id, name: group.name }} />
</>
)
}
|